import React from 'react';
import { connect } from 'dva';
import styles from './BusinessMgr.css';
import { Layout, Breadcrumb } from 'antd';
import NavMenu from '../../components/layout/NavMenu';
const { Sider, Content } = Layout;
function BusinessMgr({ children, pagePath }) {
  let paths = pagePath.split("-");
  return (
    <Layout>
      <Sider className={styles.leftMenu}>
        <NavMenu />
      </Sider>
      <Content className={styles.content}>
        <Breadcrumb className={styles.breadcrumb}>
          {
            paths.map((v, i) => {
              return <Breadcrumb.Item>{v}</Breadcrumb.Item>;
            })
          }
        </Breadcrumb>
        {children}
      </Content>
    </Layout>
  );
}

function mapStateToProps(state) {
  return {
    pagePath: state.businessMgr.pagePath
  };
}

export default connect(mapStateToProps)(BusinessMgr);
